home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c,comp.lang.c.moderated,comp.os.ms-windows.programmer.misc
- Subject: Re: Text representation of a number...
- Date: 14 Feb 1996 21:06:12 -0600
- Organization: CERN European Lab for Particle Physics
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4fu7v4$9c4@solutions.solon.com>
- References: <4fjm7r$odb@solutions.solon.com> <4fst12$2a9@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4fst12$2a9@solutions.solon.com> news@rose.com (news) writes:
-
- >In article <4fjm7r$odb@solutions.solon.com>,
- >Joel York <yorkjoe@elof.acc.iit.edu> wrote:
- >>
- >>I'm in need of an algorithm to take an eight-byte integer (not supported
- >>as a native type in Windows 3.1), and print its ASCII representation
- >>to a file. This number comes from a server that stores the number in
- >>big-endian format, but I could switch it if necessary. If anyone
- >
- >read the number into an array of 8 chars
- >using binary shifts, re-create the number into an unsigned long int
- >fprintf to file using %lu
-
- Do people actually _think_ before posting "solutions"?
-
- How the hell can you fit a 64-bit integer into a 32-bit unsigned long,
- using binary shifts? People working in the data compression field would
- _love_ to find the answer :-)
-
- [1. Remove all zeroes. They don't carry any voltage anyway. 2. Count the
- ones. You have no more than 64. Any number < 64 can be easily fit in
- an unsigned long. Sheesh, doesn't anyone *think* anymore? -mod]
-
- [I leave uncompression as an exercise for God. -mod]
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-